import { wait } from "@/utils/await";

export default {
  namespace: "attendance",
  state: {},
  effects: {
    *getAttendanceData({ payload }, { call, put, select }) {
      //   const { data } = yield call(queryUser, payload);
      yield wait();
      const data = {
        later: {
          title: "迟到人数",
          value: [
            {
              value: 1,
              date: "2025-01-01",
            },
            {
              value: 3,
              date: "2025-01-03",
            },
            {
              value: 4,
              date: "2025-01-04",
            },
            {
              value: 10,
              date: "2025-01-05",
            },
            {
              value: 5,
              date: "2025-01-06",
            },
            {
              value: 10,
              date: "2025-01-07",
            },
          ],
        },
        early: {
          title: "早退员工数量",
          value: [
            {
              value: 23,
              date: "2025-01-01",
            },
            {
              value: 3,
              date: "2025-01-03",
            },
            {
              value: 3,
              date: "2025-01-04",
            },
            {
              value: 10,
              date: "2025-01-05",
            },
            {
              value: 19,
              date: "2025-01-06",
            },
            {
              value: 10,
              date: "2025-01-07",
            },
          ],
        },
        table: {
          title: "员工列表",
          value: [
            {
              name: "张三",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "迟到",
            }, //随机
            {
              name: "李四",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "迟到",
            },
            {
              name: "王五",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "迟到",
            },
            {
              name: "赵六",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "早退",
            },
            {
              name: "孙七",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "迟到",
            },
            {
              name: "周八",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "早退",
            },
            {
              name: "吴九",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "迟到",
            },
            {
              name: "郑十",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "早退",
            },
            {
              name: "张三",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "迟到",
            },
            {
              name: "李四",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "早退",
            },
            {
              name: "王五",
              date: "2025-01-01:08:00",
              partment: "事业1部",
              reason: "早退",
            },
          ],
        },
      };

      yield put({ type: "setAttendanceData", payload: data });
    },
  },

  reducers: {
    setAttendanceData(state, { payload }) {
      return {
        ...state,
        attendance: payload,
      };
    },
  },
};
